package gui.tables.models;

import javax.swing.DefaultListSelectionModel;
import javax.swing.table.DefaultTableModel;

public class MyTableModel extends DefaultTableModel {

	/**
	 * 
	 */
	private static int lastRow;
	private static  boolean insertNewRow = false;
	private static boolean edit = false;
	
	public boolean isCellEditable(int row, int col) {
		
		
		
		//System.out.println(row + " " + insertNewRow + " " + lastRow);
		if (insertNewRow && lastRow == row && col > 0) {
			System.out.println("primu if");
			return true;
		}
		if (lastRow == row && edit && col > 0) {
			System.out.println("a doilea if");
			return true;
		}
		// Note that the data/cell address is constant,
		// no matter where the cell appears onscreen.
		return false;
	}
	
	public void setLastRow(int i){
		this.lastRow = i;
	}
	
	public void setInsertNewRow(boolean  i){
		System.out.println("tipa aisi ii fals");
		this.insertNewRow = i;
	}
	
	public void setEdit(boolean i){
		this.edit = i;
	}
	
	public int getLastRow(){
		return this.lastRow;
	}
	
}
